package com.mew.common.enm;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author dylin
 * @create 2021/3/26
 */
public enum TaskAwardType {
    GoldCoin(1, "金币"),
    Stamp(2, "邮票"),
    EmpiricalValue(3, "经验值");

    private final static Map<Integer, TaskAwardType> stateMap
            = Arrays.stream(TaskAwardType.values()).collect(Collectors.toMap(TaskAwardType::code, code -> code));

    private final int code;
    private final String desc;


    TaskAwardType(final int code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int code() {
        return this.code;
    }


    public static TaskAwardType parse(int code) {
        return stateMap.get(code);
    }

    public String desc(){
        return this.desc;
    }
}
